package org.anjoy.ktv.adapter;

import java.util.ArrayList;

import org.anjoy.ktv.R;
import org.anjoy.ktv.bean.Song;
import org.anjoy.ktv.bean.Star;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class StarAdapter extends ArrayAdapter<Star> {

	private final LayoutInflater mInflater;
	private Context mContext;
	ArrayList<Star> stars;

	public StarAdapter(Context context, ArrayList<Star> stars) {
		super(context, 0, stars);
		mContext = context;
		mInflater = LayoutInflater.from(context);
		this.stars = stars;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Star star = stars.get(position);
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.ktv_star_item, parent,
					false);
		}
		ImageView songAuthorImg = (ImageView)convertView.findViewById(R.id.star_photo);
		//songAuthorImg.setImageResource(R.drawable.ktv_mtv_default);
		
		TextView songName = (TextView)convertView.findViewById(R.id.star_name);
		songName.setText(star.getStarName());
		return convertView;
	}

}
